home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
src
/
swtools
/
trubasic
/
rolldemos
/
demos
/
interact
/
tbmap.tru
< prev
next >
Wrap
Text File
|
1994-08-02
|
2KB
|
74 lines
! ****************************************************************************
! file: tbmap
!
! function: draws a mesh where each cell represents a colormap entry.
! (similar to cmap on the Silicon Graphics)
!
! note: current designed only for 24-bit plane systems with the True BASIC
! Graphics Library version. Notes below describe changes needed to
! run on the Indigo or under X11.
!
! note: this program is written using singlebuffer mode.
! to avoid the slight flicker when the image is redrawn, use doublebuffer mode.
!
! modified for X Windows to address non-negative colors (system colors on
! the SG) and limit scope since only first 80 or so color cells are loaded
! at start-up.
!
! ****************************************************************************
! set the title
call tw_wset_title(0,"tbmap")
call tw_wset_size(0,300,300)
clear
ask max color maxc
call drawmap
do
if key input then stop
if refresh(1)=1 then
clear
call drawmap
end if
get mouse x,y,state
if state<>0 then stop
loop
get key k
end
! NOTES FOR SG VERSION
! for the GL negative color numbers indicate system colors.
! to support X windows which maps True BASIC colors to X colors the program
! could just use positive numbers. It might also want to represent another
! map with the X colors onto which the True BASIC colors are mapped.
! for the Indigo the colormap size is 256 and the offset for where
! True BASIC colors begin is 16.
! for 24-bit plane systems the map size is 1024 and the offset is 256.
! we assume a 24-bit plane system here.
! to support the 8-bit plane indigo, you would have to adjust the variable
! "c" below. The size of the colormap can be determined using the
! function def winfo(n) with n=0.
! notice on the actual window that the colors over the max color wrap
! to repeat the original part of the TB colormap. These colors are the
! top 16 colors in the window.
! NOTES FOR SG VERSION
sub drawmap
!let c=-256 ! SG version
let c=0
let xinc=1/10
!let xinc=1/32 ! SG version
for i=0 to 1-xinc step xinc
for j=0 to 1-xinc step xinc
set color c
box area j,j+xinc,i,i+xinc
set color "grey" ! for X we can specify most colors by name
box lines j,j+xinc,i,i+xinc
let c=c+1
next j
next i
end sub